object scalaFunData2 {
  def main(args: Array[String]): Unit = {
    val arr1=Array(1,2,3,4,5,6)
    arr1.filter(t=>if (t%2==0)true else false).foreach(println)
    arr1.filter(t=>t%2==0).foreach(println)
    arr1.filter(_%2==0).foreach(println)
    val arr2=Array(Array(1,2,3),Array(3,6,9))
    arr2.flatten.foreach(println)
    val arr3=Array("a b c","d e f")
    println("===================")
    arr3.flatMap(t=>t.split("")).foreach(println)
    val arr4=Array(("a","b"),("c","d"))
    arr4.flatMap(t =>Array(t._1,t._2)).foreach(println)
    val wordArr=List("hello scala","hello python","hello java")
    val wordSplit=wordArr.map(_.split(""))
    val worldFaltten=wordSplit.flatten
    println()



  }

}
